//顺序查找

#pragma once

//在数组a[n]中查找x顺序查找
//若找到返回下标，否则返回-1
template <typename E>
int SqSearch(E a[],int n,E x)
{
    for (int i=0;i<n;i++)
    if (a[i] == x) return i;

    return -1; //not found
}